<?php

include_once("config.php");
include_once("db_connect.php");
include_once("restrito.php");

//include_once 'model/bean/Usuario.class.php';


//obtem usuario da sessao
$usuario = unserialize($_SESSION["usuario"]);

if($usuario->getId() != ""){
	$dica = "Editando usuário";
}else{
	$dica = "Cadastrando novo usuário";
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Eventos Acadêmicos</title>
<link href="blueprint/screen.css" rel="stylesheet" type="text/css" media="all" />
<link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.js" ></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.js" ></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>

<script src="js/functions.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('#form-questionario').validate({
            rules:{
                nome:{
                    required: true,
                    minlength: 3
                },
				email:{
                    required: true,
                    email: true
                },
				login:{
					required: true,
					minlength: 4,
					lettersonly: true
				}
            },
            messages:{
                nome:{
                    required: "O campo nome é obrigatorio.",
                    minlength: "O campo nome deve conter no mínimo 3 caracteres."
				},
				email:{
                    required: "O campo email é obrigatorio.",
                    email: "Informe um email válido."
                },
				login:{
					required: "O campo login é obrigatorio.",
					minlength: "O campo login deve conter no mínimo 4 caracteres.",
					lettersonly: "Digite apenas letras."
				}
            }
 
        });
    });
</script>
</head>

<body>

<!--<div id="mask"></div>-->

<div id="wrapper">

<div id="header">
	<div id="logo_instituicao">
    	<img src="<?php echo $logo_instituicao; ?>" alt="Logo" />
    </div>
    <div id="logo_sistema">
    	<img src="<?php echo $logo_sistema; ?>" alt="Ambiente Online" />
    </div>
</div>
<div id="content">
	<div id="sidebar">
    	<?php include("user_info_inc.php"); ?>
        <?php include("menu_inc.php"); ?>
    </div>
    <div id="main_content">
   	    <div id="notifications">
   	  		<?php include("notification_inc.php"); ?>
   	  	</div>
      
      

<div id="boxTitlePage">
	<span class="title">USUÁRIOS</span>
	<span><?php echo $dica;?></span>
</div>

<form action="controller/usuarioController.php" id="form-questionario" method="post">
        	<input type="hidden" name="id" value="<?php echo $usuario->getId(); ?>"/>
            <input type="hidden" name="action" value="save"/>
            
            <label for="nome">Nome</label><br />
            <input type="text" value="<?php echo utf8_encode( $usuario->getNome() );?>" name="nome" id="nome"/><br />
        	
        	<label for="email">Email</label><br />
            <input type="text" value="<?php echo utf8_encode( $usuario->getEmail() );?>" name="email" id="email"/><br />
            
            <label for="login">Login</label><br />
            <input type="text" value="<?php echo utf8_encode( $usuario->getLogin() );?>" name="login" id="login"/><br />
            
            <input type="checkbox" value="1" name="gerar_senha" id="gerar_senha"/><label for="gerar_senha">Gerar senha </label><span style="font-size:smaller">(Se marcado o usuário receberá uma nova senha no email)</span><br />
            
            
            <br /><br />
            
                    
        	
        	<div id="barra_botoes">
            	<button class="botaoGoogleBlue float-right" type="submit" name="enviar">Salvar</button>
            	<button class="botaoGoogleBlue float-right" type="reset" name="cancelar">Cancelar</button>        	        
            </div>
            <div class="clear"></div>
            </form>
        
        
    </div>
</div>
<div id="footer">
	<div id="developers">
    	<img src="<?php echo $logo_developer; ?>" />
    </div>
    <div id="footer_address">
    	<?php echo $nome_faculdade_completo; ?><br />
        <?php echo $endereco_faculdade; ?>
    </div>
</div>
</div><!-- fecha wrapper-->

</body>
</html>
